package com.isunland.managesystem.ui;

import android.support.v4.app.Fragment;
import com.isunland.managesystem.entity.EmployeeLoanContent;
import com.isunland.managesystem.utils.LogUtil;

/**
 * Created by lenovo on 2016/6/2.
 */
public class ManageReimburseDetailActivity extends SingleFragmentActivity {
  public static final String EXTRA_TYPE =
      "com.isunland.managesystem.ui.ManageReimburseDetailActivity.EXTRA_TYPE";

  // 判断是差旅添加详情
  public static final int EXTRA_ADDCONTENTTYPE = 0;
  // 判断差旅修改详情
  public static final int EXTRA_EDITCONTENTTYPE = 1;
  private android.support.v4.app.Fragment mFragment;
  private String code;

  @Override protected Fragment createFragment() {
    /**根据type判断是添加还是修改详情
     */
    int type = getIntent().getIntExtra(EXTRA_TYPE, 0);

    switch (type) {
      //添加，连网
      case EXTRA_ADDCONTENTTYPE:
        //接收传过来的content
        code = getIntent().getStringExtra(AddManageReimburseDetailFragment.EXTRA_CODE);
        //                mFragment= AddTravelReimburseDetailFragment.newInstance(code);
        mFragment = AddManageReimburseDetailFragment.newInstance(code);
        LogUtil.i("==========" + code);
        break;

      //修改
      case EXTRA_EDITCONTENTTYPE:
        //接收传过来的content
        EmployeeLoanContent item2 = (EmployeeLoanContent) getIntent().getSerializableExtra(
            EditeManageReimburseFragment.EXTRA_TRAVELREIMBURSE_CONTENT);

        //                mFragment=EditeTravelReimburseFragment.newInstance(item2);
        mFragment = EditeManageReimburseFragment.newInstance(item2);
        break;
      default:
        break;
    }

    return mFragment;
  }
}

